S.Pager = (startChangePage)->
    eo = {}
    $pager = $(ST.Pager())

    pageNo = 1
    pageSize = 10

    $pageSize = $('.page-size', $pager)
    $pageSize.on 'change', (e)->
        e.preventDefault()
        pageSize = $pageSize.val() if $pageSize.val()

    $pageInfo = $('.page-info', $pager)
    $prevPage = $('.prev-page', $pager).hide().click ->
        pageNo-- if pageNo > 1
        startChangePage(pageNo, pageSize)
    $nextPage = $('.next-page', $pager).hide().click ->
        pageNo++
        startChangePage(pageNo, pageSize)
    $('.refresh', $pager).click ->
        startChangePage(pageNo, pageSize)

    eo.$pager = $pager

    eo.gotPageInfo = (actualPageNo, actualPageSize, total)->
        console.log 'got page info'
        pageNo = actualPageNo
        pageSize = actualPageSize

        pageNum = Math.ceil(total / pageSize)
        $prevPage.hide()
        $nextPage.hide()
        $prevPage.show() if pageNo > 1
        $nextPage.show() if pageNo < pageNum
        $pageInfo.html "第#{pageNo}页，共#{total}条"
    eo.refresh = ->
        startChangePage(pageNo, pageSize)

    return eo
